home *** CD-ROM | disk | FTP | other *** search
/ SunSoft Catalyst CDWARE 1996 May to August / Catalyst CDWARE 1996 May to August.iso / .products / .bin / httpd / Solaris_2 / catIPX.bkcsh < prev    next >
Text File  |  1995-06-27  |  3KB  |  156 lines

  1. #!/bin/csh
  2. # below is a scrpit launched by catIPX.pl from the Solaris Product
  3. # Expo home page.  It ultimately generates a query page to be 
  4. # displayed by the cgi-bin/catIPX.pl script.
  5. # December 14, 1994 Marc Sacoolas
  6.  
  7. #
  8. # Get search string, filter-type and category
  9. #
  10.  
  11.  
  12.  
  13. set keyword = `awk -F^ '{ print $1 }' /tmp/httpd/tmp `
  14. set filter = `awk -F^ '{ print $2 }' /tmp/httpd/tmp `
  15. set catagory = `awk -F^ '{ print $3 }' /tmp/httpd/tmp `
  16. set catword = `awk -F^ '{ print $3 }' /tmp/httpd/tmp `
  17. set display = `awk -F^ '{ print $4 }' /tmp/httpd/tmp `
  18.  
  19.  
  20.  
  21.  
  22. # clear temporary files 
  23.  
  24. set srchtyp = "topics or products"
  25. rm /tmp/httpd/top
  26. touch /tmp/httpd/top
  27. rm /tmp/httpd/tmp
  28. touch /tmp/httpd/tmp
  29.  
  30. #
  31. # goto index.html directory and grep files for keyword
  32. #
  33.  
  34. cd ../../.products
  35.  
  36.  
  37. foreach dir (`ls`)
  38. set yes  = `grep -il $keyword $dir/index.html` 
  39. if ( $yes != "" )
  40.  
  41. # read in company name and log
  42.  
  43. awk -F ' { if (NR == 1) {print $0}}' $dir/_info > /tmp/httpd/top 
  44.  
  45. cd ../.bin/httpd/cgi-bin
  46.  
  47. # create top file with search string including or operator
  48.  
  49. awk  -F ' { \
  50. if ( n==2 )printf("|") \
  51. printf($1) \
  52. n=2 \
  53. }' /tmp/httpd/tmp >> /tmp/httpd/top
  54. set topcat = `awk -F^ '{ print $1 }' /tmp/httpd/top `
  55.  
  56. # print lines wich match company names given by grep
  57.  
  58. awk  -F ' BEGIN { } \
  59. {\
  60. if ( $1 ~ /'"$topcat"'/ ) print $0\
  61. }' /tmp/httpd/dbase.isv >> /tmp/httpd/dbase.tmp
  62.  
  63.  
  64.         breaksw
  65.     endsw
  66. else
  67. set srchtyp = "categories"
  68. # catagory field is not Category...get category
  69.  
  70. awk  -F^ ' BEGIN {  } \
  71. { \
  72. if ( n == 1 ) catword = $3 \
  73. if ( n == 2 && $4 ~ /'"$catword"'/ ) print $0 \
  74. }' n=1 /tmp/httpd/tmp n=2 /tmp/httpd/dbase.isv >> /tmp/httpd/dbase.tmp
  75.  
  76.  
  77. endif
  78.  
  79.  
  80. # remove old page
  81. rm /tmp/httpd/isv.grfx.html
  82.  
  83. #
  84. # creat new page based on resource file generated above if Logos is requested
  85. #
  86.  
  87.  
  88. cat /tmp/httpd/head.html > /tmp/httpd/isv.grfx.html
  89.  
  90. # get number of answers and print
  91. set return = `grep -c ^ /tmp/httpd/dbase.tmp`
  92. if ( $return == 1 ) then 
  93. set booths = "booth."
  94. else
  95. set booths = "booths."
  96. endif 
  97. echo "<I> Your search of  </I>'<B>$srchtyp</B>' <I>for  </I>'<B>$keyword</B>' <I>produced  </I><B>$return</B> <I> $booths</I>" >> /tmp/httpd/isv.grfx.html 
  98. echo "<p>" >> /tmp/httpd/isv.grfx.html 
  99. if ( $display == "logo" ) then
  100.  
  101. awk -F^ '{ \
  102. if (flag == 0) \
  103. { \
  104. printf("<a href="$2"><img align=middle src="$3" alt=""></a>") \
  105. for (c = 0;c < 1;c++) \
  106. printf(" ") \
  107. flag=1 \
  108. }\
  109. else \
  110. {\
  111. print "<a href="$2"><img align=middle src="$3" alt=""></a>" \
  112. print "<p>" \
  113. flag=0 \
  114. } \
  115. }' /tmp/httpd/dbase.tmp >> /tmp/httpd/isv.grfx.html
  116.  
  117. else
  118.  
  119. awk -F^ '{ \
  120. print "<H2><a href="$2">"$1"</a></H2>" \
  121. }' /tmp/httpd/dbase.tmp >> /tmp/httpd/isv.grfx.html
  122.  
  123. endif
  124. if ( `/usr/ucb/test -s /tmp/httpd/dbase.tmp`)then
  125. echo "then"
  126. else
  127. echo "else"
  128. endif
  129. #
  130. # if nothing was placed in dbase.tmp, put message there
  131. #
  132. if (-z /tmp/httpd/dbase.tmp) then
  133.  
  134. echo "<pre>" >> /tmp/httpd/isv.grfx.html
  135. echo "</pre>" >> /tmp/httpd/isv.grfx.html
  136. echo "<H2> Go Back and try again.</H2>" >> /tmp/httpd/isv.grfx.html
  137.  
  138. endif
  139.  
  140. # put footer on html page
  141.  
  142. cat /tmp/httpd/tail.html >> /tmp/httpd/isv.grfx.html
  143.  
  144.  
  145. #
  146. # clear dbase.tmp file
  147. #
  148. rm /tmp/httpd/dbase.tmp
  149. touch /tmp/httpd/dbase.tmp
  150. exit 0
  151.  
  152. #setenv KEYWORD2  `echo "$keyword" | sed 's/\[//g' | sed 's/]//g'` 
  153. #set keyword = `cat /tmp/httpd/tmp` 
  154.  
  155.  
  156.